unit uFrmVeiculo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uCadPadrao, DB, ActnList, ImgList, StdCtrls, Buttons, ExtCtrls,
  ComCtrls, uDM1, Mask, DBCtrls, FMTBcd, DBClient, Provider, SqlExpr, ppDB,
  ppDBPipe, ppParameter, ppDesignLayer, ppComm, ppRelatv, ppProd, ppClass,
  ppReport;

type
  TFrmVeiculo = class(TFrmCadPadrao)
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure APesquisarExecute(Sender: TObject);
    procedure AInserirExecute(Sender: TObject);
    procedure AImprimirExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmVeiculo: TFrmVeiculo;

implementation

uses uFrmPesquisaPadrao2, uClasses, uClassesPesquisa;


{$R *.dfm}

procedure TFrmVeiculo.AImprimirExecute(Sender: TObject);
begin
  inherited;
  TFuncoes.AbrirImpressosAcao('VEICULO',DS1.DataSet.FieldByName('COD_VEICULO').AsString);
end;

procedure TFrmVeiculo.AInserirExecute(Sender: TObject);
begin
  inherited;
  DS1.DataSet.FieldByName('COD_VEICULO').AsInteger := DM1.ObterCodGenerator('COD_VEICULO');
end;

procedure TFrmVeiculo.APesquisarExecute(Sender: TObject);
begin
  inherited;
  TFuncoesPesquisa.CriarFormPesquisa('VEICULO','VEIC','COD_VEICULO','Pesquisa - Veiculo');
  TFuncoes.PesquisaPadraoForm(FrmPesquisaPadrao2.Pesquisa,DS1,DM1.sdsVeiculo);
end;

procedure TFrmVeiculo.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  inherited;
  DM1.sdsVeiculo.Close;
  DM1.cdsVeiculo.Close;
  DM1.sdsVeiculo.CommandText := 'select first 0 * from veiculo';
end;

procedure TFrmVeiculo.FormCreate(Sender: TObject);
begin
  DM1.sdsVeiculo.Open;
  DM1.cdsVeiculo.Open;
  inherited;
end;

end.
